﻿<META content="text/html; charset=UTF-8" http-equiv=Content-Type>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>

<body>
<?php
$departname=array();
$departname[1]="机械工程学院";
$departname[2]="计算机工程学院";
$departname[3]="自动化学院";
$departname[4]="外国语学院";
$departname[5]="材料工程学院";
$departname[6]="电力工程学院";
$departname[7]="能源与动力工程学院";
$departname[8]="通信工程学院";
$departname[9]="经济与管理学院";
$departname[10]="人文与社会科学学院";
$departname[13]="艺术与设计学院";
$departname[14]="建筑工程学院";
$departname[15]="汽车与轨道交通学院";
$departname[16]="环境工程学院";
$departname[34]="工业中心";


$db=new mysqli('localhost','root','8japNWTQaTCcS7BP','bitshebm');
if(mysqli_connect_errno($db)){
    echo mysqli_connect_error();
    exit;
}
mysqli_query($db, "SET NAMES UTF8");
$file_handle = fopen("js/njit-json.js", "r");
$majordata="";

while (!feof($file_handle)) {
    $line = fgets($file_handle);
    $majordata = $majordata . $line;
}
fclose($file_handle);

$majordata=substr_replace($majordata,"",0,13);
$majordata=substr_replace($majordata,"",strlen($majordata)-1,1);
$majorname= json_decode($majordata,TRUE);

$result=mysqli_query($db,"SELECT *  FROM `bitshebm`.`baoming`");
echo '<table width="1300" border="1" cellspacing="0" cellpadding="1"><tbody><tr><th scope="col">ID</th><th scope="col">姓名</th><th scope="col">性别</th><th scope="col">院系</th><th scope="col">专业</th><th scope="col">班级</th><th scope="col">学号</th><th scope="col">QQ</th><th scope="col">电话</th><th scope="col">擅长</th><th scope="col">期待</th>
<th scope="col">报名日期</th><th scope="col">报名端IP</th><th scope="col">报名端特征</th></tr>';
while (list($id,$name,$sex,$depart,$major,$class,$no,$qq,$tel,$skill,$expert,$bmdate,$vaip,$vafeature)=mysqli_fetch_row($result)){
    $depart=$departname[((int)$depart)];
    $majorn=array_keys($majorname[$depart]);
    $major=$majorn[$major-1];
    if($class=="1"){$class="171";}else if($class=="2"){$class="172";}else if($class=="9"){$class="175";}else if($class=="3"){$class="173";}else if($class=="4"){$class="174";}else if($class=="5"){$class="161";}else if($class=="6"){$class="162";}else if($class=="7"){$class="163";}else if($class=="8"){$class="164";}else{$tmp=$class;$class="[未知]" . $tmp;}

if($sex=='0'){$sex="女";}else if($sex=='1'){$sex="男";}
    echo "<tr><td>" . $id . "</td><td>" . $name . "</td><td>" .$sex . "</td><td>" . $depart . "</td><td>" . $major . "</td><td>" . $class . "</td><td>" .$no . "</td><td>" . $qq . "</td><td>" . $tel . "</td><td>" . $skill . "</td><td>" . $expert . "</td><td>" . $bmdate . "</td><td>" . $vaip . "</td><td>" . $vafeature . "</td></tr>";
}

echo "</tbody></table>";
/*
 * while (list($id,$name,$sex)= mysqli_fetch_row($result)){
    echo "<tr><td>" . $id . "</td><td>" . $sex .  "</td></tr>";
    
}
$result=mysqli_query($db, "SELECT `Id`, `����`, `�Ա�`, `Ժϵ`, `רҵ`, `�༶`, `ѧ��`, `QQ`, `�绰`, `�ó�`, `�ڴ�`, `��������`, `UAIP`, `UAFeature` FROM `bitshebm`.`baoming` limit 0,",$num);
while (list($id,$name,$sex,$depart,$major,$no,$qq,$tel,$skill,$expert,$bmdate,$vaip,$vafeature)=mysqli_fetch_row($result)){
    echo "<tr><td>" . $id . "</td><td>" . $sex . "</td><td>" . $depart . "</td><td>" . $major . "</td><td>" . $no . "</td><td>" . $qq . "</td><td>" . $tel . "</td><td>" . $skill . "</td><td>" . $expert . "</td><td>" . $bmdate . "</td><td>" . $vaip . "</td><td>" . $vafeature . "</td></tr>";
    
}
*/




?>
</body>
</html>